package com.example.linxilite.screen

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@Composable
fun CounterExample(modifier: Modifier = Modifier) {
    var count by remember { mutableStateOf(0) }

    Column(
        horizontalAlignment = Alignment.CenterHorizontally, //水平对齐方式：水平居中（其他选项：左/右）
        verticalArrangement = Arrangement.Center, //垂直位置：居中（其他选项：均匀分布/居中聚集/顶部/低部）
        modifier = modifier
            .fillMaxSize()
    ) {
        Text(text = "当前计数: $count", fontSize = 22.sp)
        Spacer(modifier = Modifier.height(16.dp))
        Button(onClick = { count++ }) {
            Text("点击 +1")
        }
    }
}